home *** CD-ROM | disk | FTP | other *** search
/ KeyGen Studio 2002 / KeyGen_Studio_2002.iso / Tutorials / Code Inside / Cluesurf02.txt < prev    next >
Encoding:
Text File  |  2001-09-21  |  8.4 KB  |  169 lines

  1.  
  2. Url=Http://ebliss.cjb.net
  3.  
  4. Tools needed
  5. Softice 4.05
  6. W32dasm(not really necessary)
  7. Procdump 1.6.2 final
  8. Icedump 6.0.2.3
  9. Author=Eternal Bliss
  10. Protections=self modifying code forming a messagebox
  11.  
  12. Auhors Words
  13. This is my 4th win32asm crackme.heh.
  14. It should be more difficult to patch.
  15. Patch the CrackMe to remeove the Nag.
  16. Challenge: Use the least bytes possible.
  17.  
  18. Heya all,
  19.  
  20. This is my first tutorial on dumping and patching 
  21. a nag.I'm using what they called "inline" patch and
  22. dump it with icedump.
  23.  
  24. Lets gets started :0)
  25. Start prodump, click Pe Editor and select win32asmcrackme4.exe
  26.  
  27. Entry Point:   00001000
  28. Size of image: 00005000
  29. Image Base:    00400000
  30.  
  31. Write it down and you will know why we need to know these later :P
  32.  
  33. Double click win32asmcrackme4.exe and it shows you a nag.
  34. "Please pay me to register..." then press ok and you are in the main window
  35. well close the crackme.
  36.  
  37. Start loader32 and load win32asmcrackme4 and you are in softice press F10
  38. and you will land here.
  39.  
  40. EAX=00401000   EBX=00000000   ECX=8159B420   EDX=8159B460   ESI=8159B400        
  41. EDI=815A22EC   EBP=0063FF78   ESP=0063FE38   EIP=00401002   O d I S z a P c     
  42. CS=0137   DS=013F   SS=013F   ES=013F   FS=4DB7   GS=0000                       
  43. ─────WIN32ASMCRACKME4!.text+0011──────────────────byte──────────────PROT───(0)──
  44. 013F:00401011 33 C0 66 C7 07 6A 00 83-C7 02 C7 07 68 7D 30 40  3.f..j......h}0@
  45. 013F:00401021 83 C7 04 C6 07 00 47 C7-07 68 34 30 40 83 C7 04  ......G..h40@...
  46. 013F:00401031 C6 07 00 47 66 C7 07 6A-00 83 C7 02 C7 07 E8 30  ...Gf..j.......0
  47. 013F:00401041 02 00 83 C7 04 C6 07 00-47 66 C7 07 EB 47 83 EF  ........Gf...G..
  48. ─────────────────────────────────────────────────────────────────────────PROT32─
  49. 0137:00400FFE  FFFF                INVALID                                     
  50. 0137:00401000  6A00                PUSH    00  <-------------Here                                
  51. 0137:00401002  E877020000          CALL    KERNEL32!GetModuleHandleA            
  52. 0137:00401007  A330314000          MOV     [00403130],EAX                       
  53. 0137:0040100C  BF11104000          MOV     EDI,00401011 <----copies 00401011 to edi                        
  54. 0137:00401011  33C0                XOR     EAX,EAX       <----moves eax to 0                       
  55. 0137:00401013  66C7076A00          MOV     WORD PTR [EDI],006A <------ copies 6a00 in reverse order to edi                 
  56. 0137:00401018  83C702              ADD     EDI,02                      and add 2 bytes to 401011         
  57. 0137:0040101B  C707687D3040        MOV     DWORD PTR [EDI],40307D68  <--- copies 687d3040 in reverse order            
  58. 0137:00401021  83C704              ADD     EDI,04                         add 4 bytes next to 6a00      
  59. 0137:00401024  C60700              MOV     BYTE PTR [EDI],00                   <----- copies 00 to edi(spacing)  
  60. 0137:00401027  47                  INC     EDI                                      next to 687d3040
  61. ────────────────────────────────────WIN32ASMCRACKME4+0FFE───────────────────────
  62.  
  63.  
  64. This crackme is easy to understand,it copies bytes to address 00401011 
  65. forms a messagebox and you can't find string "Please pay me to register..."
  66. the string refs in w32dasm dead listings because its encrypted.
  67. You might ask why didn't I use the breakpoint messageboxexa,thats simple 
  68. you can only see the result after the messagebox is created.What we want 
  69. is to trace through the code and you will know how it works :-))
  70. well trace until you reached this code 
  71.  
  72. EAX=00000000   EBX=00000000   ECX=815872B8   EDX=8159A1AC   ESI=815999CC        
  73. EDI=00401011   EBP=0063FF78   ESP=0063FE3C   EIP=00401052   o d I s z a P c     
  74. CS=0137   DS=013F   SS=013F   ES=013F   FS=3897   GS=0000                       
  75. ──────────────────────────────────────────────────byte──────────────PROT───(0)──
  76. 0030:00000000 9E 0F C9 00 65 04 70 00-16 00 55 0A 65 04 70 00  ....e.p...U.e.p.
  77. 0030:00000010 65 04 70 00 54 FF 00 F0-4C E1 00 F0 6F EF 00 F0  e.p.T...L...o...
  78. 0030:00000020 00 00 00 C8 28 00 55 0A-6F EF 00 F0 6F EF 00 F0  ....(.U.o...o...
  79. 0030:00000030 6F EF 00 F0 6F EF 00 F0-9A 00 55 0A 65 04 70 00  o...o.....U.e.p.
  80. ─────────────────────────────────────────────────────────────────────────PROT32─
  81. 0137:0040104F  83EF13              SUB     EDI,13                              
  82. 0137:00401052  FFE7                JMP     EDI      <---- Here                           
  83. 0137:00401054  50                  PUSH    EAX                                  
  84. 0137:00401055  E81E020000          CALL    KERNEL32!ExitProcess                 
  85. 0137:0040105A  EB15                JMP     00401071                             
  86. 0137:0040105C  1337                ADC     ESI,[EDI]                            
  87. 0137:0040105E  EB15                JMP     00401075                             
  88. 0137:00401060  1337                ADC     ESI,[EDI]                            
  89. 0137:00401062  EB15                JMP     00401079                             
  90. 0137:00401064  1337                ADC     ESI,[EDI]                            
  91. 0137:00401066  EB15                JMP     0040107D                            
  92. 0137:00401068  1337                ADC     ESI,[EDI]                         
  93. ────────────────────────────────────WIN32ASMCRACKME4!.text+004F─────────────────
  94.  
  95. This is the last piece of code which the messagebox is created   
  96. heh whew look at the window register the register edi it jumps 
  97. back to 00401011 and you see this below :P
  98.  
  99. EAX=00000000   EBX=00000000   ECX=815824F4   EDX=81586894   ESI=815774AC        
  100. EDI=00401011   EBP=0063FF78   ESP=0063FE3C   EIP=00401011   o d I s z a P c     
  101. CS=0137   DS=013F   SS=013F   ES=013F   FS=2337   GS=0000                       
  102. ─────WIN32ASMCRACKME4!.text+0011──────────────────byte──────────────PROT───(0)──
  103. 013F:00401011 6A 00 68 7D 30 40 00 68-34 30 40 00 6A 00 E8 30  j.h}0@.h40@.j..0
  104. 013F:00401021 02 00 00 EB 47 00 47 C7-07 68 34 30 40 83 C7 04  ....G.G..h40@...
  105. 013F:00401031 C6 07 00 47 66 C7 07 6A-00 83 C7 02 C7 07 E8 30  ...Gf..j.......0
  106. 013F:00401041 02 00 83 C7 04 C6 07 00-47 66 C7 07 EB 47 83 EF  ........Gf...G..
  107. ─────────────────────────────────────────────────────────────────────────PROT32─
  108. 0137:0040100C  BF11104000          MOV     EDI,00401011                        
  109. 0137:00401011  6A00                PUSH    00 <-------- You are here (this is the exit button)                                 
  110. 0137:00401013  687D304000          PUSH    0040307D    <-------push the string ref "Crackme Nag" in the memory                         
  111. 0137:00401018  6834304000          PUSH    00403034            push the string ref "Please Pay me....." in the memory                 
  112. 0137:0040101D  6A00                PUSH    00        <------this is the "ok" button                            
  113. 0137:0040101F  E830020000          CALL    USER32!MessageBoxA    <----- call the api MessageboxA             
  114. 0137:00401024  EB47                JMP     0040106D              <------jump to next instruction               
  115. 0137:00401026  0047C7              ADD     [EDI-39],AL                          
  116. 0137:00401029  07                  POP     ES                                   
  117. 0137:0040102A  6834304083          PUSH    83403034                             
  118. 0137:0040102F  C704C607004766      MOV     DWORD PTR [EAX*8+ESI],66470007      
  119. 0137:00401036  C7076A0083C7        MOV     DWORD PTR [EDI],C783006A          
  120. ────────────────────────────────────WIN32ASMCRACKME4!.text+000C─────────────────
  121.  
  122. Trace when you reached 0040101D thats the "ok" control button 
  123. "push 00" it means that the button is not press all we have to do to is assemble it
  124. and change it to push 01 which is a mouse click and hte nag is gone :P
  125.  
  126. In command window enter this
  127. "a"
  128. "push 01"
  129. <----- enter
  130. <------enter
  131.  
  132. We are ready to dump the process.
  133.  
  134. /pedump imagebase entry point c:\filename.exe
  135.  
  136. /pedump- What it does is dump the current win32 process or a dll in its address 
  137. space to a valid PE file.
  138.  
  139. Enter this without quotes 
  140. '/pedump 400000 1000 c:\unp.exe'
  141.  
  142. 'X'
  143.  
  144. and you are out of softice 
  145.  
  146. Execute unp.exe and runs :-))))))
  147.  
  148.  
  149. Last Words
  150. Hope you guys learn something from this nice crackme and from my tute,by the way I'm
  151. a newbie and I'm not a good in explaining things and do hope you enjoy reading
  152. this "tute" :P
  153. Any comments,critics,Flames are welcome :) 
  154.  
  155. Greets
  156.  
  157. Eternal Bliss (:o))
  158.  
  159. CoDe_insiDe (=D)
  160. and all who knows me
  161.  
  162. Cluesurf@usa.net  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.   
  169.